package com.alfayun.fiscalriskanalysis.report;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.alfayun.fiscalriskanalysis.reportspec.ReportType;

public interface ReportGroupRepository extends JpaRepository<ReportGroup, Integer> {

    List<ReportGroup> findByEnterpriseId(Integer enterpriseId);
    
    @Query("select distinct rg from ReportGroup rg,Report r,ReportSpec rs where r.reportGroup.id=rg.id and r.reportSpec.id=rs.id and rg.enterprise.id=?1 and rs.reportType=?2")
    List<ReportGroup> queryReportGroup(Integer enterpriseId,ReportType reportType);

}
